Skip to content

Conversation

@shetzel
Copy link
Contributor

@shetzel shetzel commented Jan 8, 2025

What does this PR do?

Modifies the code when resolving potential metadata files to not reuse the suffixType when that type doesn't match with the provided file path. Added a test to ensure this doesn't regress.

See the GitHub issue for a repro. Certain metadata types have non-unique file suffixes like "rule" or "site". These would not resolve correctly in certain code paths, such as when retrieving RestrictionRule metadata.

What issues does this PR fix or reference?

#3168
@W-17555689@

@shetzel shetzel requested a review from a team as a code owner January 8, 2025 23:46
@WillieRuemmele
Copy link
Member

QA Notes


from repro repo 🚀
before

 ➜  sf project retrieve start --metadata restrictionrule      
 ›   Warning: @salesforce/plugin-agent is a linked ESM module and cannot be auto-transpiled. Existing compiled source will be used instead.

 ────────────── Retrieving Metadata ──────────────

 Retrieving v61.0 metadata from [email protected] using the v62.0 SOAP API

 ✔ Preparing retrieve request 8ms
 ✔ Sending request to org 1.00s
 ✔ Waiting for the org to respond 309ms
 ✔ Done 0ms

 Status: Succeeded
 Elapsed Time: 1.33s

 ›   Warning: Nothing retrieved

after ✅

pd project retrieve start --metadata restrictionrule                                                             

 ────────────── Retrieving Metadata ──────────────

 Retrieving v61.0 metadata from [email protected] using the v62.0 SOAP API

 ✔ Preparing retrieve request 6ms
 ✔ Sending request to org 835ms
 ✔ Waiting for the org to respond 3.10s
 ✔ Done 0ms

 Status: Succeeded
 Elapsed Time: 4.05s


Retrieved Source
┌─────────┬──────┬─────────────────┬───────────────────────────────────────────────────────────┐
│ State   │ Name │ Type            │ Path                                                      │
├─────────┼──────┼─────────────────┼───────────────────────────────────────────────────────────┤
│ Changed │ Foo  │ RestrictionRule │ force-app/main/default/restrictionRules/Foo.rule-meta.xml │
└─────────┴──────┴─────────────────┴───────────────────────────────────────────────────────────┘

@WillieRuemmele WillieRuemmele merged commit 50cb744 into main Jan 9, 2025
52 checks passed
@WillieRuemmele WillieRuemmele deleted the sh/resolve-strict-dir-before-suffix branch January 9, 2025 18:24
peternhale pushed a commit that referenced this pull request Jan 9, 2025
…#1480)

* fix: resolve strict dirs before suffixes for potential metadata files

* fix: do not reuse suffixType if no match
peternhale added a commit that referenced this pull request Jan 24, 2025
* chore: wip

* chore: license year

* chore(release): 12.11.0 [skip ci]

* chore: only check md file (#1475)

* fix: add workflow flow actions to decomposed workflow preset and allow isAddressable (#1467)

* fix: add workflow flow actions and allow isAddressable

* fix: add workflow flow actions

* chore(release): 12.11.1 [skip ci]

* W-17279149 Register MD APIs to metadata registry (#1472)

* chore: register md apis to metadata registry

* Update metadataRegistry.json

chore:empty commit

* chore(release): 12.11.2 [skip ci]

* chore: auto-update metadata coverage in METADATA_SUPPORT.md [no ci]

* fix: update snapshot (#1478)

* chore(release): 12.11.3 [skip ci]

* feat(mdTypes): register tua viz and ws metadata types (#1479)

* chore(release): 12.12.0 [skip ci]

* chore: auto-update metadata coverage in METADATA_SUPPORT.md [no ci]

* fix: resolve strict dirs before suffixes for potential metadata files (#1480)

* fix: resolve strict dirs before suffixes for potential metadata files

* fix: do not reuse suffixType if no match

* chore(release): 12.12.1 [skip ci]

* chore: wip

* chore: wip

* chore: wip

* chore: encoded in MD, chars in SD (#1485)

* chore: wip

* chore: wip

* chore: update md xml to include xml header

* chore: temp (#1490)

* chore: wip

* Wr/decompose esr (#1492)

* chore: reset snapshots to main

* fix: deploy ESR yaml and -meta

* test: fix registry test

* chore: bump core

* chore: always decompose to yaml

The schema property contents in an esr can be either yaml of json.
For simplicity, given the property alwasy represents an Open API spec, the decomposed format of schema will be yaml.
Recomposition will use an existing xml property, schemaUploadFileExtension, to determine the format when build the MD type.

* chore: add missing expected artifacts

---------

Co-authored-by: peternhale <[email protected]>

* chore: fix test

* chore: address review suggestions

---------

Co-authored-by: Willhoit <[email protected]>
Co-authored-by: svc-cli-bot <[email protected]>
Co-authored-by: Matt Carvin <[email protected]>
Co-authored-by: Idan Roas <[email protected]>
Co-authored-by: Willie Ruemmele <[email protected]>
Co-authored-by: PKV <[email protected]>
Co-authored-by: Steve Hetzel <[email protected]>
@iowillhoit iowillhoit changed the title fix: resolve strict dirs before suffixes for potential metadata files W-17555689 fix: resolve strict dirs before suffixes for potential metadata files Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants